<?php
/*
  aphly 2018/8/16
*/
if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}
//异步通知

writelog('notify',json_encode($notify));

// $notify 接受到微信或支付全部数据

//支付宝 $notify 数据json_encode
//{"gmt_create":"2021-05-04 16:15:49","charset":"utf-8","gmt_payment":"2021-05-04 16:15:56","notify_time":"2021-05-04 16:15:57","subject":"iphone 16g","sign":"Sknuv9l3097PadUPKjJ9haB0CAOgAeIJxMtXlvnqa6JiyHXT4wr03MoPh7UBk8a0nbJNtQ\/mYcjaU97UoNdvLhJaAOsovzpuONYfhY0HOqSTuVwn8rptCq4P8IpO0UoBed1oMViSTFOIIgjQP3DYW8zGLaFhmCKmvW6gk1GTpRamhlG1KnLsoWLEwVP\/hZvL2u+IJNCNjJ4ercduJENOL9aX0EXymjsvEMKKlLXl9MR3o+akYLSR78OXuQVgAJmnM6NgSlHqVGzIUUv3fcRP6rJ+vK7m\/n56KF6Fhg4+cIDXmktoHlbIIZuWhIT+lDPhn\/ATJ0pWXLCwCDPnMKSIIA==","buyer_id":"2088102175375180","passback_params":"aphly_test","invoice_amount":"169.00","version":"1.0","notify_id":"2021050400222161556075180510715144","fund_bill_list":"[{\"amount\":\"169.00\",\"fundChannel\":\"ALIPAYACCOUNT\"}]","notify_type":"trade_status_sync","out_trade_no":"trade_16201161439284","total_amount":"169.00","trade_status":"TRADE_SUCCESS","trade_no":"2021050422001475180501131992","auth_app_id":"2016082100306929","receipt_amount":"169.00","point_amount":"0.00","app_id":"2016082100306929","buyer_pay_amount":"169.00","sign_type":"RSA2","seller_id":"2088102172453205"}

//微信 $notify 数据json_encode
//{"mchid":"1435418502","appid":"wx1d25a321f2a2aa3b","out_trade_no":"162038496371094","transaction_id":"4200001045202105074774283173","trade_type":"NATIVE","trade_state":"SUCCESS","trade_state_desc":"\u652f\u4ed8\u6210\u529f","bank_type":"OTHERS","attach":"forum_order","success_time":"2021-05-07T18:56:27+08:00","payer":{"openid":"ouiocv6lfvFrxiwqcKQieGGUKWfc"},"amount":{"total":100,"payer_total":100,"currency":"CNY","payer_currency":"CNY"}}


// $plugin_id 插件标识id
// $trade_no 微信交易号或支付宝交易号
// $buyer 购买者的微信openid或支付宝用户号
// $pay 支付类对象
if($pay->apitype=='alipay'){
	//支付宝
	//商户需要验证该通知数据中的 out_trade_no 是否为商户系统中创建的订单号；
	//判断 total_amount 是否确实为该订单的实际金额（即商户订单创建时的金额）；

	
	//业务逻辑开始
	
	//业务逻辑结束

	//$pay->success(); 成功响应给支付宝
	//$pay->fail(); 失败响应给支付宝
	$pay->success();
}else{
	//微信
	//业务逻辑开始
	
	//业务逻辑结束


	//$pay->success(); 成功响应给微信
	//$pay->fail(); 失败响应给微信
	$pay->success();
}


